import random

# 初始化残联信息
disability_federation = {
    "资源资金": 10000,
    "残疾人满意度": 50,
    "社会支持度": 50
}

# 残疾人需求列表
disability_needs = [
    {
        "需求描述": "轮椅需求",
        "资源消耗": 1000,
        "满意度提升": 20
    },
    {
        "需求描述": "就业培训需求",
        "资源消耗": 3000,
        "满意度提升": 30
    },
    {
        "需求描述": "无障碍设施改造需求",
        "资源消耗": 5000,
        "满意度提升": 40
    }
]

# 社会活动列表
social_activities = [
    {
        "活动描述": "残疾人艺术展览",
        "资源消耗": 2000,
        "社会支持度提升": 25
    },
    {
        "活动描述": "关爱残疾人公益跑",
        "资源消耗": 3500,
        "社会支持度提升": 35
    }
]


# 显示残联当前状态
def show_status():
    print("残疾人联合会当前状态：")
    print(f"资源资金: {disability_federation['资源资金']} 元")
    print(f"残疾人满意度: {disability_federation['残疾人满意度']}")
    print(f"社会支持度: {disability_federation['社会支持度']}")


# 处理残疾人需求
def handle_needs():
    print("当前残疾人的需求有：")
    for i, need in enumerate(disability_needs, start=1):
        print(f"{i}. {need['需求描述']}，需消耗资源: {need['资源消耗']} 元，可提升满意度: {need['满意度提升']}")
    try:
        choice = int(input("请选择要处理的需求编号（输入 0 取消）："))
        if choice == 0:
            return
        if 1 <= choice <= len(disability_needs):
            selected_need = disability_needs[choice - 1]
            if disability_federation["资源资金"] >= selected_need["资源消耗"]:
                disability_federation["资源资金"] -= selected_need["资源消耗"]
                disability_federation["残疾人满意度"] += selected_need["满意度提升"]
                print(f"成功处理 {selected_need['需求描述']}，剩余资源资金: {disability_federation['资源资金']} 元，残疾人满意度提升到: {disability_federation['残疾人满意度']}")
            else:
                print("资源资金不足，无法处理该需求。")
        else:
            print("无效的选择，请重新输入。")
    except ValueError:
        print("输入无效，请输入一个数字。")


# 组织社会活动
def organize_activity():
    print("可组织的社会活动有：")
    for i, activity in enumerate(social_activities, start=1):
        print(f"{i}. {activity['活动描述']}，需消耗资源: {activity['资源消耗']} 元，可提升社会支持度: {activity['社会支持度提升']}")
    try:
        choice = int(input("请选择要组织的活动编号（输入 0 取消）："))
        if choice == 0:
            return
        if 1 <= choice <= len(social_activities):
            selected_activity = social_activities[choice - 1]
            if disability_federation["资源资金"] >= selected_activities["资源消耗"]:
                disability_federation["资源资金"] -= selected_activity["资源消耗"]
                disability_federation["社会支持度"] += selected_activity["社会支持度提升"]
                print(f"成功组织 {selected_activity['活动描述']}，剩余资源资金: {disability_federation['资源资金']} 元，社会支持度提升到: {disability_federation['社会支持度']}")
            else:
                print("资源资金不足，无法组织该活动。")
        else:
            print("无效的选择，请重新输入。")
    except ValueError:
        print("输入无效，请输入一个数字。")


# 随机事件
def random_event():
    event_chance = random.randint(1, 10)
    if event_chance <= 3:
        donation = random.randint(1000, 5000)
        disability_federation["资源资金"] += donation
        print(f"收到一笔 {donation} 元的捐赠，当前资源资金增加到: {disability_federation['资源资金']} 元。")
    elif event_chance > 3 and event_chance <= 6:
        negative_report = random.choice(["媒体负面报道", "社会质疑事件"])
        disability_federation["社会支持度"] -= 15
        print(f"发生 {negative_report}，社会支持度下降到: {disability_federation['社会支持度']}。")


# 主游戏循环
while True:
    show_status()
    random_event()
    print("\n请选择操作：")
    print("1. 处理残疾人需求")
    print("2. 组织社会活动")
    print("3. 结束游戏")
    choice = input("请输入选项编号：")
    if choice == "1":
        handle_needs()
    elif choice == "2":
        organize_activity()
    elif choice == "3":
        print("游戏结束，感谢你的参与！")
        break
    else:
        print("无效的选项，请重新输入。")